import request from '@/utils/request'
import { otherFiltersItem } from '@/utils'

// 根据id查询详细信息
export function queryById(id) {
  return request({
    url: `/api/v1/shopUpgrade/${id}`,
    method: 'get'
  })
}

// 保存门店升级改造
export function saveUpgrade(data) {
  return request({
    url: data.id ? '/api/v1/shopUpgrade/updateShopUpgrade' : '/api/v1/shopUpgrade/insertShopUpgrade',
    method: 'put',
    data
  })
}

/**
 * 根据所属模块获取文件列表
 * @returns
 */
export function postConfigAttachmentTemplate() {
  const data = new FormData()
  data.append('filtersRaw', JSON.stringify([otherFiltersItem('belongModel', 'SHOP_UPGRADE', '=')]))
  return request({
    url: '/api/v1/configAttachmentTemplate/page',
    method: 'POST',
    data
  })
}
